import java.util.Comparator;
import java.util.TreeMap;

public class Lianxi2 {
    public static void main(String[] args){
        //1.创建集合对象
        //Integer Double默认情况下按照升序排列
        //String按照ASCII码表升序排列
        TreeMap<Integer,String> tm=new TreeMap<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2-o1;
            }
        });
        //2.添加元素
        tm.put(5,"可口可乐");
        tm.put(1,"可口");
        tm.put(54,"可乐");
        tm.put(56,"可口乐");
        tm.put(7,"乐");

        //3.打印集合
        System.out.println(tm);


    }
}
